package com.cn.sl.server.common.dto

import io.swagger.v3.oas.annotations.media.Schema
import java.io.Serializable

/**
 * @param page 当前页
 * @param pageSize 每页记录数
 * @param total 总记录数
 * @param rows 查询的数据
 * @param totalPage 获取总页数
 */
@Schema(description = "分页实体")
class PageDto<T>(
    @field:Schema(description = "当前页")
    val page: Int,
    @field:Schema(description = "每页记录数")
    var pageSize: Int = DEFAULT_PAGE_SIZE,
    @field:Schema(description = "总记录数")
    val total: Int,
    @field:Schema(description = "获取总页数")
    val totalPage: Int,

    val rows: List<T>
) : Serializable {

    companion object {
        private const val DEFAULT_PAGE_SIZE = 20
    }
}